<template>
  <div class="list">
    <ul>
      <li v-for="item in list" :key="item.id">{{item.title}}</li>
    </ul>
  </div>
</template>

<script>
import eventBus from '@/event/eventBus.js'
export default {
  props:{
    list:Array
  },
  data(){
    return{
      
    }
  },
  methods:{
    handleAddTitle(title){
      console.log('title',title)
    }
  },
  mounted(){
    eventBus.$on('addItem',this.handleAddTitle)
  },
  beforeDestroy(){
    eventBus.$off('addItem',this.handleAddTitle)
  }
}
</script>